add3 <- paste ("\\midrule Previous vote share & \\multicolumn{1}{c}{Yes} & \\multicolumn{1}{c}{Yes} && \\multicolumn{1}{c}{Yes} & \\multicolumn{1}{c}{Yes} \\\\ \n")
add4 <- paste ("Year effects & \\multicolumn{1}{c}{Yes} & \\multicolumn{1}{c}{Yes} && \\multicolumn{1}{c}{Yes} & \\multicolumn{1}{c}{Yes} \\\\ \n")
add5 <- paste ("State effects & \\multicolumn{1}{c}{No} & \\multicolumn{1}{c}{Yes} && \\multicolumn{1}{c}{No} & \\multicolumn{1}{c}{Yes} \\\\ \n")
add6 <- paste ("num. obs. & \\multicolumn{1}{c}{", sprintf ("%.0f", round (nobs05[1],0)), "} & \\multicolumn{1}{c}{", sprintf ("%.0f", round (nobs05[2],0)), "} && \\multicolumn{1}{c}{", sprintf ("%.0f", round (nobs05[3],0)), "} & \\multicolumn{1}{c}{", sprintf ("%.0f", round (nobs05[4],0)), "}  \\\\ \n")
addtorow <- list ()
addtorow$pos <- list ()
addtorow$pos[[1]] <- 0
addtorow$pos[[2]] <- 0
addtorow$pos[[3]] <- 0
addtorow$pos[[4]] <- 10
addtorow$pos[[5]] <- 10
addtorow$pos[[6]] <- 20
addtorow$pos[[7]] <- 20
addtorow$pos[[8]] <- 20
addtorow$pos[[9]] <- 20
addtorow$pos[[10]] <- 20
addtorow$pos[[11]] <- 20
addtorow$command <- c (Header1, Header3, Header4
, add1a, Header5
, add2a, add2b, add3, add4, add5, add6)
print (xtable (  cbind (rows, parSE (tab.results05, n.digits=n.digit))
, align=c("l","l","c","c","c","c","c")
, digits=n.digit
, caption="2SLS estimates: effect of \\emph{proportion of copartisan mayors} on a congressional candidate's \\emph{probability of victory} in Mexico, 2000-2012 (unweighted averages, PRI only)"
, label="T:ivResultsUWPRI")
, sanitize.rownames.function=function(x){x}
, sanitize.text.function=function(x){x}
, floating=TRUE
, table.placement="t"
, caption.placement="top"
, latex.environments="center"
, size="small"
, include.colnames=FALSE
, include.rownames=FALSE
, hline.after = c ()
, add.to.row=addtorow  )
## Code for replicating Table A6
(tab.coefs07 <- cbind (
c (coef (sum.gov.win42pria)[length (coef (sum.gov.win42pria)[,1]),1], coef(sum.gov.win42pria)[c (3:4,2,1),1], coef (sum.gov.win42prib)[c (2,4:5,3,1),1])
, c (coef (sum.gov.win43pria)[length (coef (sum.gov.win43pria)[,1]),1], coef(sum.gov.win43pria)[c (3:4,2,1),1], coef (sum.gov.win43prib)[c (2,4:5,3,1),1])
, rep (NA, 10)
, c (coef (sum.rup.win42pria)[length (coef (sum.rup.win42pria)[,1]),1], coef(sum.rup.win42pria)[c (3:4,2,1),1], coef (sum.rup.win42prib)[c (2,4:5,3,1),1])
, c (coef (sum.rup.win43pria)[length (coef (sum.rup.win43pria)[,1]),1], coef(sum.rup.win43pria)[c (3:4,2,1),1], coef (sum.rup.win43prib)[c (2,4:5,3,1),1])
))
(tab.ses07 <- cbind (
c (coef (sum.gov.win42pria)[length (coef (sum.gov.win42pria)[,2]),2], coef(sum.gov.win42pria)[c (3:4,2,1),2], coef (sum.gov.win42prib)[c (2,4:5,3,1),2])
, c (coef (sum.gov.win43pria)[length (coef (sum.gov.win43pria)[,2]),2], coef(sum.gov.win43pria)[c (3:4,2,1),2], coef (sum.gov.win43prib)[c (2,4:5,3,1),2])
, rep (NA, 10)
, c (coef (sum.rup.win42pria)[length (coef (sum.rup.win42pria)[,2]),2], coef(sum.rup.win42pria)[c (3:4,2,1),2], coef (sum.rup.win42prib)[c (2,4:5,3,1),2])
, c (coef (sum.rup.win43pria)[length (coef (sum.rup.win43pria)[,2]),2], coef(sum.rup.win43pria)[c (3:4,2,1),2], coef (sum.rup.win43prib)[c (2,4:5,3,1),2])
))
odd <- seq (1, nrow (tab.coefs07)*2, by=2)
even <- seq (2, nrow (tab.coefs07)*2, by=2)
(tab.results07 <- data.frame (rbind (tab.coefs07, tab.ses07)))
rownames (tab.results07) <- c (odd, even)
tab.results07 <- tab.results07[order (as.numeric (rownames (tab.results07))),]
rows <- c ("Proportion of copartisan mayors", "~~~~~(instrumented)"
, "Margin of victory (lagged)", ""
, "Poverty", ""
, "Proportion of close elections", ""
, "Intercept", ""
, "Proportion barely won/lost", ""
, "Margin of victory (lagged)", ""
, "Poverty", ""
, "Proportion of close elections", ""
, "Intercept", "")
(sigma07a <- c (
sum.gov.win42pria$rse, sum.gov.win43pria$rse
, sum.rup.win42pria$rse, sum.rup.win43pria$rse))
(sigma07b <- c (
sum.gov.win42prib$rse, sum.gov.win43prib$rse
, sum.rup.win42prib$rse, sum.rup.win43prib$rse))
(fstat07 <- c (
lfe::waldtest(gov.win42prib, "gover.treat025.w", type="cluster")[5], lfe::waldtest(gov.win43prib, "gover.treat025.w", type="cluster")[5]
, lfe::waldtest(rup.win42prib, "runnerup.treat025.w", type="cluster")[5], lfe::waldtest(rup.win43prib, "runnerup.treat025.w", type="cluster")[5]))
(nobs07 <- c (
sum.gov.win42pria$N, sum.gov.win43pria$N
, sum.rup.win42pria$N, sum.rup.win43pria$N))
Header1 <- paste ("\\toprule & \\multicolumn{2}{c}{\\emph{Copartisan governor}} && \\multicolumn{2}{c}{\\emph{Opposition governor}} \\\\ \\cline{2-3} \\cline{5-6} \n")
Header3 <- paste (" & \\multicolumn{1}{c}{(1)} & \\multicolumn{1}{c}{(2)} && \\multicolumn{1}{c}{(3)} & \\multicolumn{1}{c}{(4)} \\\\ \\midrule \n")
Header4 <- paste ("\\multicolumn{6}{l}{\\underline{(a) Second stage regression} (outcome: \\emph{copartisan victory})} \\\\ [1.5ex] \n")
Header5 <- paste ("\\multicolumn{6}{l}{\\underline{(b) First stage regression} (outcome: \\emph{proportion of copartisan mayors})} \\\\ [1.5ex] \n")
add1a <- paste ("\\midrule RMSE & \\multicolumn{1}{c}{", sprintf ("%.2f", round (sigma07a[1],2)), "} & \\multicolumn{1}{c}{", sprintf ("%.2f", round (sigma07a[2],2)), "} && \\multicolumn{1}{c}{", sprintf ("%.2f", round (sigma07a[3],2)), "} & \\multicolumn{1}{c}{", sprintf ("%.2f", round (sigma07a[4],2)), "}  \\\\ \\midrule \n")
add2a <- paste ("\\midrule RMSE & \\multicolumn{1}{c}{", sprintf ("%.2f", round (sigma07b[1],2)), "} & \\multicolumn{1}{c}{", sprintf ("%.2f", round (sigma07b[2],2)), "} && \\multicolumn{1}{c}{", sprintf ("%.2f", round (sigma07b[3],2)), "} & \\multicolumn{1}{c}{", sprintf ("%.2f", round (sigma07b[4],2)), "}  \\\\ \n")
add2b <- paste ("$F$-statistic (excl. instrument) & \\multicolumn{1}{c}{", sprintf ("%.0f", round (fstat07[1],0)), "} & \\multicolumn{1}{c}{", sprintf ("%.0f", round (fstat07[2],0)), "} && \\multicolumn{1}{c}{", sprintf ("%.0f", round (fstat07[3],0)), "} & \\multicolumn{1}{c}{", sprintf ("%.0f", round (fstat07[4],0)), "}  \\\\ \n")
add3 <- paste ("\\midrule Previous vote share & \\multicolumn{1}{c}{Yes} & \\multicolumn{1}{c}{Yes} && \\multicolumn{1}{c}{Yes} & \\multicolumn{1}{c}{Yes} \\\\ \n")
add4 <- paste ("Year effects & \\multicolumn{1}{c}{Yes} & \\multicolumn{1}{c}{Yes} && \\multicolumn{1}{c}{Yes} & \\multicolumn{1}{c}{Yes} \\\\ \n")
add5 <- paste ("State effects & \\multicolumn{1}{c}{No} & \\multicolumn{1}{c}{Yes} && \\multicolumn{1}{c}{No} & \\multicolumn{1}{c}{Yes} \\\\ \n")
add6 <- paste ("num. obs. & \\multicolumn{1}{c}{", sprintf ("%.0f", round (nobs07[1],0)), "} & \\multicolumn{1}{c}{", sprintf ("%.0f", round (nobs07[2],0)), "} && \\multicolumn{1}{c}{", sprintf ("%.0f", round (nobs07[3],0)), "} & \\multicolumn{1}{c}{", sprintf ("%.0f", round (nobs07[4],0)), "}  \\\\ \n")
addtorow <- list ()
addtorow$pos <- list ()
addtorow$pos[[1]] <- 0
addtorow$pos[[2]] <- 0
addtorow$pos[[3]] <- 0
addtorow$pos[[4]] <- 10
addtorow$pos[[5]] <- 10
addtorow$pos[[6]] <- 20
addtorow$pos[[7]] <- 20
addtorow$pos[[8]] <- 20
addtorow$pos[[9]] <- 20
addtorow$pos[[10]] <- 20
addtorow$pos[[11]] <- 20
addtorow$command <- c (Header1, Header3, Header4
, add1a, Header5
, add2a, add2b, add3, add4, add5, add6)
print (xtable (  cbind (rows, parSE (tab.results07, n.digits=n.digit))
, align=c("l","l","c","c","c","c","c")
, digits=n.digit
, caption="2SLS estimates: effect of \\emph{proportion of copartisan mayors} on a congressional candidate's \\emph{probability of victory} in Mexico, 2000-2012 (2.5pp margin, PRI only)"
, label="T:ivResults025PRI")
, sanitize.rownames.function=function(x){x}
, sanitize.text.function=function(x){x}
, floating=TRUE
, table.placement="t"
, caption.placement="top"
, latex.environments="center"
, size="small"
, include.colnames=FALSE
, include.rownames=FALSE
, hline.after = c ()
, add.to.row=addtorow  )
## Code for replicating Table A7
(tab.coefs08 <- cbind (
c (coef.gov.win12[c(2:4,1),1], coef.gov.win12pri[c (2:4,1),1])
, c (coef.gov.win13[c(2:4,1),1], coef.gov.win13pri[c (2:4,1),1])
, rep (NA, 8)
, c (coef.rup.win12[c(2:4,1),1], coef.rup.win12pri[c (2:4,1),1])
, c (coef.rup.win13[c(2:4,1),1], coef.rup.win13pri[c (2:4,1),1])
))
(tab.ses08 <- cbind (
c (coef.gov.win12[c(2:4,1),2], coef.gov.win12pri[c (2:4,1),2])
, c (coef.gov.win13[c(2:4,1),2], coef.gov.win13pri[c (2:4,1),2])
, rep (NA, 8)
, c (coef.rup.win12[c(2:4,1),2], coef.rup.win12pri[c (2:4,1),2])
, c (coef.rup.win13[c(2:4,1),2], coef.rup.win13pri[c (2:4,1),2])
))
odd <- seq (1, nrow (tab.coefs08)*2, by=2)
even <- seq (2, nrow (tab.coefs08)*2, by=2)
(tab.results08 <- data.frame (rbind (tab.coefs08, tab.ses08)))
rownames (tab.results08) <- c (odd, even)
tab.results08 <- tab.results08[order (as.numeric (rownames (tab.results08))),]
rows <- c ("Proportion of copartisan mayors", ""
, "Margin of victory (lagged)", ""
, "Poverty", ""
, "Intercept", ""
, "Proportion of copartisan mayors", ""
, "Margin of victory (lagged)", ""
, "Poverty", ""
, "Intercept", "")
(nobs08 <- c (
gov.win12$df.null, gov.win13$df.null
, rup.win12$df.null, rup.win13$df.null) + 1)
(nobs08pri <- c (
gov.win12pri$df.null, gov.win13pri$df.null
, rup.win12pri$df.null, rup.win13pri$df.null) + 1)
(ndev08 <- c (
gov.win12$null.deviance, gov.win13$null.deviance
, rup.win12$null.deviance, rup.win13$null.deviance))
(ndev08pri <- c (
gov.win12pri$null.deviance, gov.win13pri$null.deviance
, rup.win12pri$null.deviance, rup.win13pri$null.deviance))
(dev08 <- c (
gov.win12$deviance, gov.win13$deviance
, rup.win12$deviance, rup.win13$deviance))
(dev08pri <- c (
gov.win12pri$deviance, gov.win13pri$deviance
, rup.win12pri$deviance, rup.win13pri$deviance))
(aic08 <- c (
gov.win12$aic, gov.win13$aic
, rup.win12$aic, rup.win13$aic))
(aic08pri <- c (
gov.win12pri$aic, gov.win13pri$aic
, rup.win12pri$aic, rup.win13pri$aic))
Header1 <- paste ("\\toprule & \\multicolumn{2}{c}{\\emph{Copartisan governor}} && \\multicolumn{2}{c}{\\emph{Opposition governor}} \\\\ \\cline{2-3} \\cline{5-6} \n")
Header3 <- paste (" & \\multicolumn{1}{c}{(1)} & \\multicolumn{1}{c}{(2)} && \\multicolumn{1}{c}{(3)} & \\multicolumn{1}{c}{(4)} \\\\ \\midrule \n")
Header4 <- paste ("\\multicolumn{6}{l}{\\underline{(a) Full Sample}} \\\\ [1.5ex] \n")
Header5 <- paste ("\\multicolumn{6}{l}{\\underline{(b) PRI-only Sample}} \\\\ [1.5ex] \n")
add1a <- paste ("\\midrule Null deviance & \\multicolumn{1}{c}{", sprintf ("%.1f", round (ndev08[1],1)), "} & \\multicolumn{1}{c}{", sprintf ("%.1f", round (ndev08[2],1)), "} && \\multicolumn{1}{c}{", sprintf ("%.1f", round (ndev08[3],1)), "} & \\multicolumn{1}{c}{", sprintf ("%.1f", round (ndev08[4],1)), "}  \\\\ \n")
add1b <- paste ("Residual deviance & \\multicolumn{1}{c}{", sprintf ("%.1f", round (dev08[1],1)), "} & \\multicolumn{1}{c}{", sprintf ("%.1f", round (dev08[2],1)), "} && \\multicolumn{1}{c}{", sprintf ("%.1f", round (dev08[3],1)), "} & \\multicolumn{1}{c}{", sprintf ("%.1f", round (dev08[4],1)), "}  \\\\ \n")
add1c <- paste ("AIC & \\multicolumn{1}{c}{", sprintf ("%.1f", round (aic08[1],1)), "} & \\multicolumn{1}{c}{", sprintf ("%.1f", round (aic08[2],1)), "} && \\multicolumn{1}{c}{", sprintf ("%.1f", round (aic08[3],1)), "} & \\multicolumn{1}{c}{", sprintf ("%.1f", round (aic08[4],1)), "}  \\\\ \n")
add1d <- paste ("num. obs. & \\multicolumn{1}{c}{", sprintf ("%.0f", round (nobs08[1],0)), "} & \\multicolumn{1}{c}{", sprintf ("%.0f", round (nobs08[2],0)), "} && \\multicolumn{1}{c}{", sprintf ("%.0f", round (nobs08[3],0)), "} & \\multicolumn{1}{c}{", sprintf ("%.0f", round (nobs08[4],0)), "}  \\\\ \\midrule \n")
add2a <- paste ("\\midrule Null deviance & \\multicolumn{1}{c}{", sprintf ("%.1f", round (ndev08pri[1],1)), "} & \\multicolumn{1}{c}{", sprintf ("%.1f", round (ndev08pri[2],1)), "} && \\multicolumn{1}{c}{", sprintf ("%.1f", round (ndev08pri[3],1)), "} & \\multicolumn{1}{c}{", sprintf ("%.1f", round (ndev08pri[4],1)), "}  \\\\ \n")
add2b <- paste ("Residual deviance & \\multicolumn{1}{c}{", sprintf ("%.1f", round (dev08pri[1],1)), "} & \\multicolumn{1}{c}{", sprintf ("%.1f", round (dev08pri[2],1)), "} && \\multicolumn{1}{c}{", sprintf ("%.1f", round (dev08pri[3],1)), "} & \\multicolumn{1}{c}{", sprintf ("%.1f", round (dev08pri[4],1)), "}  \\\\ \n")
add2c <- paste ("AIC & \\multicolumn{1}{c}{", sprintf ("%.1f", round (aic08pri[1],1)), "} & \\multicolumn{1}{c}{", sprintf ("%.1f", round (aic08pri[2],1)), "} && \\multicolumn{1}{c}{", sprintf ("%.1f", round (aic08pri[3],1)), "} & \\multicolumn{1}{c}{", sprintf ("%.1f", round (aic08pri[4],1)), "}  \\\\ \n")
add2d <- paste ("num. obs. & \\multicolumn{1}{c}{", sprintf ("%.0f", round (nobs08pri[1],0)), "} & \\multicolumn{1}{c}{", sprintf ("%.0f", round (nobs08pri[2],0)), "} && \\multicolumn{1}{c}{", sprintf ("%.0f", round (nobs08pri[3],0)), "} & \\multicolumn{1}{c}{", sprintf ("%.0f", round (nobs08pri[4],0)), "}  \\\\ \\midrule \n")
add3 <- paste ("Previous vote share & \\multicolumn{1}{c}{Yes} & \\multicolumn{1}{c}{Yes} && \\multicolumn{1}{c}{Yes} & \\multicolumn{1}{c}{Yes} \\\\ \n")
add4 <- paste ("Year effects & \\multicolumn{1}{c}{Yes} & \\multicolumn{1}{c}{Yes} && \\multicolumn{1}{c}{Yes} & \\multicolumn{1}{c}{Yes} \\\\ \n")
add5 <- paste ("State effects & \\multicolumn{1}{c}{No} & \\multicolumn{1}{c}{Yes} && \\multicolumn{1}{c}{No} & \\multicolumn{1}{c}{Yes} \\\\ \n")
addtorow <- list ()
addtorow$pos <- list ()
addtorow$pos[[1]] <- 0
addtorow$pos[[2]] <- 0
addtorow$pos[[3]] <- 0
addtorow$pos[[4]] <- 8
addtorow$pos[[5]] <- 8
addtorow$pos[[6]] <- 8
addtorow$pos[[7]] <- 8
addtorow$pos[[8]] <- 8
addtorow$pos[[9]] <- 16
addtorow$pos[[10]] <- 16
addtorow$pos[[11]] <- 16
addtorow$pos[[12]] <- 16
addtorow$pos[[13]] <- 16
addtorow$pos[[14]] <- 16
addtorow$pos[[15]] <- 16
addtorow$command <- c (Header1, Header3, Header4
, add1a, add1b, add1c, add1d, Header5
, add2a, add2b, add2c, add2d, add3, add4, add5)
print (xtable (  cbind (rows, parSE (tab.results08, n.digits=n.digit))
, align=c("l","l","c","c","c","c","c")
, digits=n.digit
, caption="Probit estimates: \\emph{proportion of copartisan mayors} on a congressional candidate's \\emph{probability of victory} in Mexico, 2000-2012"
, label="T:robustProbit")
, sanitize.rownames.function=function(x){x}
, sanitize.text.function=function(x){x}
, floating=TRUE
, table.placement="t"
, caption.placement="top"
, latex.environments="center"
, size="small"
, include.colnames=FALSE
, include.rownames=FALSE
, hline.after = c ()
, add.to.row=addtorow  )
## Code for replicating Table A8
(tab.coefs09 <- cbind (
c (coef(sum.gov.sh02)[c(2:4,1),1], coef(sum.gov.sh02pri)[c (2:4,1),1])
, c (coef(sum.gov.sh03)[c(2:4,1),1], coef(sum.gov.sh03pri)[c (2:4,1),1])
, rep (NA, 8)
, c (coef(sum.rup.sh02)[c(2:4,1),1], coef(sum.rup.sh02pri)[c (2:4,1),1])
, c (coef(sum.rup.sh03)[c(2:4,1),1], coef(sum.rup.sh03pri)[c (2:4,1),1])
))
(tab.ses09 <- cbind (
c (coef(sum.gov.sh02)[c(2:4,1),2], coef(sum.gov.sh02pri)[c (2:4,1),2])
, c (coef(sum.gov.sh03)[c(2:4,1),2], coef(sum.gov.sh03pri)[c (2:4,1),2])
, rep (NA, 8)
, c (coef(sum.rup.sh02)[c(2:4,1),2], coef(sum.rup.sh02pri)[c (2:4,1),2])
, c (coef(sum.rup.sh03)[c(2:4,1),2], coef(sum.rup.sh03pri)[c (2:4,1),2])
))
odd <- seq (1, nrow (tab.coefs09)*2, by=2)
even <- seq (2, nrow (tab.coefs09)*2, by=2)
(tab.results09 <- data.frame (rbind (tab.coefs09, tab.ses09)))
rownames (tab.results09) <- c (odd, even)
tab.results09 <- tab.results09[order (as.numeric (rownames (tab.results09))),]
rows <- c ("Proportion of copartisan mayors", ""
, "Margin of victory (lagged)", ""
, "Poverty", ""
, "Intercept", ""
, "Proportion of copartisan mayors", ""
, "Margin of victory (lagged)", ""
, "Poverty", ""
, "Intercept", "")
(nobs09 <- c (
sum.gov.sh02$N, sum.gov.sh03$N
, sum.rup.sh02$N, sum.rup.sh03$N))
(nobs09pri <- c (
sum.gov.sh02pri$N, sum.gov.sh03pri$N
, sum.rup.sh02pri$N, sum.rup.sh03pri$N))
(sigma03 <- c (
sum.gov.sh02$rse, sum.gov.sh03$rse
, sum.rup.sh02$rse, sum.rup.sh03$rse))
(sigma03pri <- c (
sum.gov.sh02pri$rse, sum.gov.sh03pri$rse
, sum.rup.sh02pri$rse, sum.rup.sh03pri$rse))
Header1 <- paste ("\\toprule & \\multicolumn{2}{c}{\\emph{Copartisan governor}} && \\multicolumn{2}{c}{\\emph{Opposition governor}} \\\\ \\cline{2-3} \\cline{5-6} \n")
Header3 <- paste (" & \\multicolumn{1}{c}{(1)} & \\multicolumn{1}{c}{(2)} && \\multicolumn{1}{c}{(3)} & \\multicolumn{1}{c}{(4)} \\\\ \\midrule \n")
Header4 <- paste ("\\multicolumn{6}{l}{\\underline{(a) Full Sample}} \\\\ [1.5ex] \n")
Header5 <- paste ("\\multicolumn{6}{l}{\\underline{(b) PRI-only Sample}} \\\\ [1.5ex] \n")
add1a <- paste ("\\midrule RMSE & \\multicolumn{1}{c}{", sprintf ("%.2f", round (sigma03[1],2)), "} & \\multicolumn{1}{c}{", sprintf ("%.2f", round (sigma03[2],2)), "} && \\multicolumn{1}{c}{", sprintf ("%.2f", round (sigma03[3],2)), "} & \\multicolumn{1}{c}{", sprintf ("%.2f", round (sigma03[4],2)), "}  \\\\ \n")
add1b <- paste ("num. obs. & \\multicolumn{1}{c}{", sprintf ("%.0f", round (nobs09[1],0)), "} & \\multicolumn{1}{c}{", sprintf ("%.0f", round (nobs09[2],0)), "} && \\multicolumn{1}{c}{", sprintf ("%.0f", round (nobs09[3],0)), "} & \\multicolumn{1}{c}{", sprintf ("%.0f", round (nobs09[4],0)), "}  \\\\ \\midrule \n")
add2a <- paste ("\\midrule RMSE & \\multicolumn{1}{c}{", sprintf ("%.2f", round (sigma03pri[1],2)), "} & \\multicolumn{1}{c}{", sprintf ("%.2f", round (sigma03pri[2],2)), "} && \\multicolumn{1}{c}{", sprintf ("%.2f", round (sigma03pri[3],2)), "} & \\multicolumn{1}{c}{", sprintf ("%.2f", round (sigma03pri[4],2)), "}  \\\\ \n")
add2b <- paste ("num. obs. & \\multicolumn{1}{c}{", sprintf ("%.0f", round (nobs09pri[1],0)), "} & \\multicolumn{1}{c}{", sprintf ("%.0f", round (nobs09pri[2],0)), "} && \\multicolumn{1}{c}{", sprintf ("%.0f", round (nobs09pri[3],0)), "} & \\multicolumn{1}{c}{", sprintf ("%.0f", round (nobs09pri[4],0)), "}  \\\\ \\midrule \n")
add3 <- paste ("Previous vote share & \\multicolumn{1}{c}{Yes} & \\multicolumn{1}{c}{Yes} && \\multicolumn{1}{c}{Yes} & \\multicolumn{1}{c}{Yes} \\\\ \n")
add4 <- paste ("Year effects & \\multicolumn{1}{c}{Yes} & \\multicolumn{1}{c}{Yes} && \\multicolumn{1}{c}{Yes} & \\multicolumn{1}{c}{Yes} \\\\ \n")
add5 <- paste ("State effects & \\multicolumn{1}{c}{No} & \\multicolumn{1}{c}{Yes} && \\multicolumn{1}{c}{No} & \\multicolumn{1}{c}{Yes} \\\\ \n")
addtorow <- list ()
addtorow$pos <- list ()
addtorow$pos[[1]] <- 0
addtorow$pos[[2]] <- 0
addtorow$pos[[3]] <- 0
addtorow$pos[[4]] <- 8
addtorow$pos[[5]] <- 8
addtorow$pos[[6]] <- 8
addtorow$pos[[7]] <- 16
addtorow$pos[[8]] <- 16
addtorow$pos[[9]] <- 16
addtorow$pos[[10]] <- 16
addtorow$pos[[11]] <- 16
addtorow$command <- c (Header1, Header3, Header4
, add1a, add1b, Header5
, add2a, add2b, add3, add4, add5)
print (xtable (  cbind (rows, parSE (tab.results09, n.digits=n.digit))
, align=c("l","l","c","c","c","c","c")
, digits=n.digit
, caption="OLS estimates: \\emph{proportion of copartisan mayors} on a congressional candidate's \\emph{vote share}"
, label="T:robustShare")
, sanitize.rownames.function=function(x){x}
, sanitize.text.function=function(x){x}
, floating=TRUE
, table.placement="t"
, caption.placement="top"
, latex.environments="center"
, size="small"
, include.colnames=FALSE
, include.rownames=FALSE
, hline.after = c ()
, add.to.row=addtorow  )
## Code for replicating Table A9
(tab.coefs10 <- cbind (
c (coef(sum.gov.mg02)[c(2:4,1),1], coef(sum.gov.mg02pri)[c (2:4,1),1])
, c (coef(sum.gov.mg03)[c(2:4,1),1], coef(sum.gov.mg03pri)[c (2:4,1),1])
, rep (NA, 8)
, c (coef(sum.rup.mg02)[c(2:4,1),1], coef(sum.rup.mg02pri)[c (2:4,1),1])
, c (coef(sum.rup.mg03)[c(2:4,1),1], coef(sum.rup.mg03pri)[c (2:4,1),1])
))
(tab.ses10 <- cbind (
c (coef(sum.gov.mg02)[c(2:4,1),2], coef(sum.gov.mg02pri)[c (2:4,1),2])
, c (coef(sum.gov.mg03)[c(2:4,1),2], coef(sum.gov.mg03pri)[c (2:4,1),2])
, rep (NA, 8)
, c (coef(sum.rup.mg02)[c(2:4,1),2], coef(sum.rup.mg02pri)[c (2:4,1),2])
, c (coef(sum.rup.mg03)[c(2:4,1),2], coef(sum.rup.mg03pri)[c (2:4,1),2])
))
odd <- seq (1, nrow (tab.coefs10)*2, by=2)
even <- seq (2, nrow (tab.coefs10)*2, by=2)
(tab.results10 <- data.frame (rbind (tab.coefs10, tab.ses10)))
rownames (tab.results10) <- c (odd, even)
tab.results10 <- tab.results10[order (as.numeric (rownames (tab.results10))),]
rows <- c ("Proportion of copartisan mayors", ""
, "Margin of victory (lagged)", ""
, "Poverty", ""
, "Intercept", ""
, "Proportion of copartisan mayors", ""
, "Margin of victory (lagged)", ""
, "Poverty", ""
, "Intercept", "")
(nobs10 <- c (
sum.gov.mg02$N, sum.gov.mg03$N
, sum.rup.mg02$N, sum.rup.mg03$N))
(nobs10pri <- c (
sum.gov.mg02pri$N, sum.gov.mg03pri$N
, sum.rup.mg02pri$N, sum.rup.mg03pri$N))
(sigma10 <- c (
sum.gov.mg02$rse, sum.gov.mg03$rse
, sum.rup.mg02$rse, sum.rup.mg03$rse))
(sigma10pri <- c (
sum.gov.mg02pri$rse, sum.gov.mg03pri$rse
, sum.rup.mg02pri$rse, sum.rup.mg03pri$rse))
Header1 <- paste ("\\toprule & \\multicolumn{2}{c}{\\emph{Copartisan governor}} && \\multicolumn{2}{c}{\\emph{Opposition governor}} \\\\ \\cline{2-3} \\cline{5-6} \n")
Header3 <- paste (" & \\multicolumn{1}{c}{(1)} & \\multicolumn{1}{c}{(2)} && \\multicolumn{1}{c}{(3)} & \\multicolumn{1}{c}{(4)} \\\\ \\midrule \n")
Header4 <- paste ("\\multicolumn{6}{l}{\\underline{(a) Full Sample}} \\\\ [1.5ex] \n")
Header5 <- paste ("\\multicolumn{6}{l}{\\underline{(b) PRI-only Sample}} \\\\ [1.5ex] \n")
add1a <- paste ("\\midrule RMSE & \\multicolumn{1}{c}{", sprintf ("%.2f", round (sigma10[1],2)), "} & \\multicolumn{1}{c}{", sprintf ("%.2f", round (sigma10[2],2)), "} && \\multicolumn{1}{c}{", sprintf ("%.2f", round (sigma10[3],2)), "} & \\multicolumn{1}{c}{", sprintf ("%.2f", round (sigma10[4],2)), "}  \\\\ \n")
add1b <- paste ("num. obs. & \\multicolumn{1}{c}{", sprintf ("%.0f", round (nobs10[1],0)), "} & \\multicolumn{1}{c}{", sprintf ("%.0f", round (nobs10[2],0)), "} && \\multicolumn{1}{c}{", sprintf ("%.0f", round (nobs10[3],0)), "} & \\multicolumn{1}{c}{", sprintf ("%.0f", round (nobs10[4],0)), "}  \\\\ \\midrule \n")
add2a <- paste ("\\midrule RMSE & \\multicolumn{1}{c}{", sprintf ("%.2f", round (sigma10pri[1],2)), "} & \\multicolumn{1}{c}{", sprintf ("%.2f", round (sigma10pri[2],2)), "} && \\multicolumn{1}{c}{", sprintf ("%.2f", round (sigma10pri[3],2)), "} & \\multicolumn{1}{c}{", sprintf ("%.2f", round (sigma10pri[4],2)), "}  \\\\ \n")
add2b <- paste ("num. obs. & \\multicolumn{1}{c}{", sprintf ("%.0f", round (nobs10pri[1],0)), "} & \\multicolumn{1}{c}{", sprintf ("%.0f", round (nobs10pri[2],0)), "} && \\multicolumn{1}{c}{", sprintf ("%.0f", round (nobs10pri[3],0)), "} & \\multicolumn{1}{c}{", sprintf ("%.0f", round (nobs10pri[4],0)), "}  \\\\ \\midrule \n")
add3 <- paste ("Previous vote share & \\multicolumn{1}{c}{Yes} & \\multicolumn{1}{c}{Yes} && \\multicolumn{1}{c}{Yes} & \\multicolumn{1}{c}{Yes} \\\\ \n")
add4 <- paste ("Year effects & \\multicolumn{1}{c}{Yes} & \\multicolumn{1}{c}{Yes} && \\multicolumn{1}{c}{Yes} & \\multicolumn{1}{c}{Yes} \\\\ \n")
add5 <- paste ("State effects & \\multicolumn{1}{c}{No} & \\multicolumn{1}{c}{Yes} && \\multicolumn{1}{c}{No} & \\multicolumn{1}{c}{Yes} \\\\ \n")
addtorow <- list ()
addtorow$pos <- list ()
addtorow$pos[[1]] <- 0
addtorow$pos[[2]] <- 0
addtorow$pos[[3]] <- 0
addtorow$pos[[4]] <- 8
addtorow$pos[[5]] <- 8
addtorow$pos[[6]] <- 8
addtorow$pos[[7]] <- 16
addtorow$pos[[8]] <- 16
addtorow$pos[[9]] <- 16
addtorow$pos[[10]] <- 16
addtorow$pos[[11]] <- 16
addtorow$command <- c (Header1, Header3, Header4
, add1a, add1b, Header5
, add2a, add2b, add3, add4, add5)
print (xtable (  cbind (rows, parSE (tab.results10, n.digits=n.digit))
, align=c("l","l","c","c","c","c","c")
, digits=n.digit
, caption="OLS estimates: \\emph{proportion of copartisan mayors} on a congressional candidate's \\emph{margin of victory}"
, label="T:robustMargin")
, sanitize.rownames.function=function(x){x}
, sanitize.text.function=function(x){x}
, floating=TRUE
, table.placement="t"
, caption.placement="top"
, latex.environments="center"
, size="small"
, include.colnames=FALSE
, include.rownames=FALSE
, hline.after = c ()
, add.to.row=addtorow  )
## Code for replicating Table A10
(tab.coefs11 <- cbind (
c (coef(sum.gov.win05)[c(2:5,1),1], coef(sum.gov.win05pri)[c (2:5,1),1])
, c (coef(sum.gov.win06)[c(2:5,1),1], coef(sum.gov.win06pri)[c (2:5,1),1])
, rep (NA, 10)
, c (coef(sum.rup.win05)[c(2:5,1),1], coef(sum.rup.win05pri)[c (2:5,1),1])
, c (coef(sum.rup.win06)[c(2:5,1),1], coef(sum.rup.win06pri)[c (2:5,1),1])
))
(tab.ses11 <- cbind (
c (coef(sum.gov.win05)[c(2:5,1),2], coef(sum.gov.win05pri)[c (2:5,1),2])
, c (coef(sum.gov.win06)[c(2:5,1),2], coef(sum.gov.win06pri)[c (2:5,1),2])
, rep (NA, 10)
, c (coef(sum.rup.win05)[c(2:5,1),2], coef(sum.rup.win05pri)[c (2:5,1),2])
, c (coef(sum.rup.win06)[c(2:5,1),2], coef(sum.rup.win06pri)[c (2:5,1),2])
))
odd <- seq (1, nrow (tab.coefs11)*2, by=2)
even <- seq (2, nrow (tab.coefs11)*2, by=2)
(tab.results11 <- data.frame (rbind (tab.coefs11, tab.ses11)))
rownames (tab.results11) <- c (odd, even)
tab.results11 <- tab.results11[order (as.numeric (rownames (tab.results11))),]
rows <- c ("Proportion of copartisan mayors", ""
, "Effective number of municipalities", ""
, "Margin of victory (lagged)", ""
, "Poverty", ""
, "Intercept", ""
, "Proportion of copartisan mayors", ""
, "Effective number of municipalities", ""
, "Margin of victory (lagged)", ""
, "Poverty", ""
, "Intercept", "")
(nobs11 <- c (
sum.gov.win05$N, sum.gov.win06$N
, sum.rup.win05$N, sum.rup.win06$N))
(nobs11pri <- c (
sum.gov.win05pri$N, sum.gov.win06pri$N
, sum.rup.win05pri$N, sum.rup.win06pri$N))
(sigma11 <- c (
sum.gov.win05$rse, sum.gov.win06$rse
, sum.rup.win05$rse, sum.rup.win06$rse))
(sigma11pri <- c (
sum.gov.win05pri$rse, sum.gov.win06pri$rse
, sum.rup.win05pri$rse, sum.rup.win06pri$rse))
Header1 <- paste ("\\toprule & \\multicolumn{2}{c}{\\emph{Copartisan governor}} && \\multicolumn{2}{c}{\\emph{Opposition governor}} \\\\ \\cline{2-3} \\cline{5-6} \n")
Header3 <- paste (" & \\multicolumn{1}{c}{(1)} & \\multicolumn{1}{c}{(2)} && \\multicolumn{1}{c}{(3)} & \\multicolumn{1}{c}{(4)} \\\\ \\midrule \n")
Header4 <- paste ("\\multicolumn{6}{l}{\\underline{(a) Full Sample}} \\\\ [1.5ex] \n")
Header5 <- paste ("\\multicolumn{6}{l}{\\underline{(b) PRI-only Sample}} \\\\ [1.5ex] \n")
add1a <- paste ("\\midrule RMSE & \\multicolumn{1}{c}{", sprintf ("%.2f", round (sigma11[1],2)), "} & \\multicolumn{1}{c}{", sprintf ("%.2f", round (sigma11[2],2)), "} && \\multicolumn{1}{c}{", sprintf ("%.2f", round (sigma11[3],2)), "} & \\multicolumn{1}{c}{", sprintf ("%.2f", round (sigma11[4],2)), "}  \\\\ \n")
add1b <- paste ("num. obs. & \\multicolumn{1}{c}{", sprintf ("%.0f", round (nobs11[1],0)), "} & \\multicolumn{1}{c}{", sprintf ("%.0f", round (nobs11[2],0)), "} && \\multicolumn{1}{c}{", sprintf ("%.0f", round (nobs11[3],0)), "} & \\multicolumn{1}{c}{", sprintf ("%.0f", round (nobs11[4],0)), "}  \\\\ \\midrule \n")
add2a <- paste ("\\midrule RMSE & \\multicolumn{1}{c}{", sprintf ("%.2f", round (sigma11pri[1],2)), "} & \\multicolumn{1}{c}{", sprintf ("%.2f", round (sigma11pri[2],2)), "} && \\multicolumn{1}{c}{", sprintf ("%.2f", round (sigma11pri[3],2)), "} & \\multicolumn{1}{c}{", sprintf ("%.2f", round (sigma11pri[4],2)), "}  \\\\ \n")
add2b <- paste ("num. obs. & \\multicolumn{1}{c}{", sprintf ("%.0f", round (nobs11pri[1],0)), "} & \\multicolumn{1}{c}{", sprintf ("%.0f", round (nobs11pri[2],0)), "} && \\multicolumn{1}{c}{", sprintf ("%.0f", round (nobs11pri[3],0)), "} & \\multicolumn{1}{c}{", sprintf ("%.0f", round (nobs11pri[4],0)), "}  \\\\ \\midrule \n")
add3 <- paste ("Previous vote share & \\multicolumn{1}{c}{Yes} & \\multicolumn{1}{c}{Yes} && \\multicolumn{1}{c}{Yes} & \\multicolumn{1}{c}{Yes} \\\\ \n")
add4 <- paste ("Year effects & \\multicolumn{1}{c}{Yes} & \\multicolumn{1}{c}{Yes} && \\multicolumn{1}{c}{Yes} & \\multicolumn{1}{c}{Yes} \\\\ \n")
add5 <- paste ("State effects & \\multicolumn{1}{c}{No} & \\multicolumn{1}{c}{Yes} && \\multicolumn{1}{c}{No} & \\multicolumn{1}{c}{Yes} \\\\ \n")
addtorow <- list ()
addtorow$pos <- list ()
addtorow$pos[[1]] <- 0
addtorow$pos[[2]] <- 0
addtorow$pos[[3]] <- 0
addtorow$pos[[4]] <- 10
addtorow$pos[[5]] <- 10
addtorow$pos[[6]] <- 10
addtorow$pos[[7]] <- 20
addtorow$pos[[8]] <- 20
addtorow$pos[[9]] <- 20
addtorow$pos[[10]] <- 20
addtorow$pos[[11]] <- 20
addtorow$command <- c (Header1, Header3, Header4
, add1a, add1b, Header5
, add2a, add2b, add3, add4, add5)
print (xtable (  cbind (rows, parSE (tab.results11, n.digits=n.digit))
, align=c("l","l","c","c","c","c","c")
, digits=n.digit
, caption="OLS estimates: controlling for the effective number of municipalities"
, label="T:robustENM")
, sanitize.rownames.function=function(x){x}
, sanitize.text.function=function(x){x}
, floating=TRUE
, table.placement="t"
, caption.placement="top"
, latex.environments="center"
, size="small"
, include.colnames=FALSE
, include.rownames=FALSE
, hline.after = c ()
, add.to.row=addtorow  )
## Code for replicating Table A11
(coefWin <- rbind (
with (gov.win01rdd, c (coef[2], se[2], pv[2], bws[1], N_h_l, N_h_r))
, with (rup.win01rdd, c (coef[2], se[2], pv[2], bws[1], N_h_l, N_h_r))
, with (gov.tnt01rdd, c (coef[2], se[2], pv[2], bws[1], N_h_l, N_h_r))
, with (rup.tnt01rdd, c (coef[2], se[2], pv[2], bws[1], N_h_l, N_h_r))
))
# adding the asterisks
(coefWin2 <- cbind (matrix (sprintf ("%.2f", round (coefWin[,c (1:2,4)], 3)), ncol=3)
, matrix (sprintf ("%.0f", coefWin[,5:6]), ncol=2)))
coefWin2[,2] <- ifelse (coefWin[,3] <= 0.05, paste (coefWin2[,2], "$^{*}$", sep=""), ifelse (coefWin[,3] <= 0.10, paste (coefWin2[,2], "$^{\\dagger}$", sep=""), coefWin2[,2]))
rows <- rep (c ("Copartisan governor", "Non-copartisan governor"))
Header2 <- paste ("\\toprule \\multicolumn{1}{c}{} & \\multicolumn{1}{c}{LATE} & \\multicolumn{1}{c}{SE} & \\multicolumn{1}{c}{bwd.} & \\multicolumn{1}{c}{$N^{-}$} & \\multicolumn{1}{c}{$N^{+}$} \\\\ \\midrule \n")
Header3 <- paste ("\\multicolumn{6}{l}{\\underline{Local linear regression} (outcome: \\emph{copartisan victory})} \\\\ [1ex] \n")
Header4 <- paste ("[2.5ex] \\multicolumn{6}{l}{\\underline{Local linear regression} (outcome: \\emph{turnout})} \\\\ [1ex] \n")
addtorow <- list ()
addtorow$pos <- list ()
addtorow$pos[[1]] <- 0
addtorow$pos[[2]] <- 0
addtorow$pos[[3]] <- 2
addtorow$command <- c (Header2, Header3, Header4)
print (xtable (cbind (rows, coefWin2)
, align=c("l","l","r","l","c","r","c")
, digits=n.digit
, caption="RD estimates of \\emph{municipal incumbency} on the municipal-level performance of Mexican congressional candiates, 2000-2012"
, label="T:rdResults")
, sanitize.rownames.function=function(x){x}
, sanitize.text.function=function(x){x}
, floating=TRUE
, table.placement="t"
, caption.placement="top"
, latex.environments="center"
, size="small"
, include.colnames=FALSE
, include.rownames=FALSE
, hline.after = c ()
, add.to.row=addtorow)
